package com.ruoyi.oa.mapper;

import com.ruoyi.common.annotation.DataColumn;
import com.ruoyi.common.annotation.DataPermission;
import com.ruoyi.oa.domain.OaHumanReplace;
import com.ruoyi.oa.domain.bo.OaHumanReplaceBo;
import com.ruoyi.oa.domain.vo.OaHumanReplaceVo;
import com.ruoyi.common.core.mapper.BaseMapperPlus;
import java.util.List;
import com.ruoyi.oa.domain.vo.OaProjectVo;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * 补卡申请Mapper接口
 *
 * @author ruoyi
 * @date 2023-08-07
 */
public interface OaHumanReplaceMapper extends BaseMapperPlus<OaHumanReplaceMapper, OaHumanReplace, OaHumanReplaceVo> {
    @DataPermission({
        @DataColumn(key = "deptName", value = "dept_id"),
        @DataColumn(key = "userName", value = "user_id")
    })
    List<OaHumanReplaceVo> queryByCondition(OaHumanReplaceBo bo);


    /***
     * 通过月份和id获取本月补卡次数
     * @param month
     * @param userId
     * @return
     */
    @Select("\tSELECT *\n" +
        "\tFROM oa_human_replace\n" +
        "\tWHERE replace_time LIKE CONCAT( CONCAT( '%', #{month}), '%' )  and user_id=#{userId}")
    List<OaHumanReplaceVo> getUserReplaceByMonth(@Param("month") String month, @Param("userId") String userId);
}
